<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::post('goods/{id}', 'AdminController@getGoods');
Route::post('admin', 'AdminController@index');

Route::middleware(['auth:api'])->group(function () {
    Route::group([
        'namespace' => 'Admin',
        'prefix'    => 'admin'
    ], function ($router) {
        //域名配置相关相关start
        Route::post('member/index', 'MemberController@index');//列表
        Route::post('member/add', 'MemberController@create');//新增域名配置记录
        Route::post('member/destroy/{id}', 'MemberController@destroy');//删除域名记录
        Route::post('member/editMember/{id}', 'MemberController@editMember');//编辑域名记录
        Route::post('member/info/{id}', 'MemberController@info');//获取详情
        Route::post('member/indexErrorLog', 'MemberController@indexErrorLog');//错误日志列表
        //域名配置相关相关end
    });

});


Route::group([
    'namespace' => 'Admin',
    'prefix'    => 'admin'
], function ($router) {
    Route::post('member/addErrorLog', 'MemberController@addErrorLog');//新增错误日志
});


/**
 * 后台路由
 */

/**后台模块**/
Route::group(['namespace' => 'Admin', 'prefix' => 'admin'], function () {
    /**需要登录认证模块**/
    Route::middleware(['auth:admin', 'rbac'])->group(function () {

        Route::resource('index', 'IndexsController', ['only' => ['index']]);  //首页

        Route::get('index/main', 'IndexsController@main')->name('index.main'); //首页数据分析

        Route::get('admins/status/{statis}/{admin}', 'AdminsController@status')->name('admins.status');

        Route::get('admins/delete/{admin}', 'AdminsController@delete')->name('admins.delete');

        Route::resource('admins', 'AdminsController', ['only' => ['index', 'create', 'store', 'update', 'edit']]); //管理员

        Route::get('roles/access/{role}', 'RolesController@access')->name('roles.access');

        Route::post('roles/group-access/{role}', 'RolesController@groupAccess')->name('roles.group-access');

        Route::resource('roles', 'RolesController', ['only' => ['index', 'create', 'store', 'update', 'edit', 'destroy']]);  //角色

        Route::get('rules/status/{status}/{rules}', 'RulesController@status')->name('rules.status');

        Route::resource('rules', 'RulesController', ['only' => ['index', 'create', 'store', 'update', 'edit', 'destroy']]);  //权限

        Route::resource('actions', 'ActionLogsController', ['only' => ['index', 'destroy']]);  //日志
    });
});


